<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const route1 = [
            {
            path: '/',
            component: 'wudi',
            redirect: '/workplace',
            children: [
                {
                    path: 'workplace',
                    name: '工作台',
                    component: () => import('@/pages/home/index'),
                    meta: {
                        icon: 'dashboard'
                    },
                }
            ]
        },
        {
            path: 'patrol',
            name: '巡店管理',
            meta: {
                icon: 'form'
            },
            component: 'wudi',
            redirect: '/patrol/shoprecords',
            children: [
                {
                    path: 'shoprecords',
                    name: '巡店记录',
                    component: () => import('@/pages/patrol/shoprecords'),
                },
                {
                    path: 'shopstatistics',
                    name: '巡店统计',
                    component: () => import('@/pages/patrol/shopstatistics'),
                },
                {
                    path: 'shopconfig',
                    name: '巡店配置',
                    component: () => import('@/pages/patrol/shopconfig'),
                },
            ]
        },
        {
            path: 'task',
            name: '任务管理',
            meta: {
                icon: 'table',
            },
            component: 'wudi',
            redirect: '/task/taskrecord',
            children: [
                {
                    path: 'taskrecord',
                    name: '任务记录',
                    component: () => import('@/pages/task/taskrecord'),
                },
                {
                    path: 'taskstatistics',
                    name: '任务统计',
                    component: () => import('@/pages/task/taskstatistics'),
                },
                {
                    path: 'taskconfig',
                    name: '任务配置',
                    component: () => import('@/pages/task/taskconfig'),
                }
            ]
        }
    ]
        
        const route2 = [
            {
            path: '/',
            component: 'wudi',
            redirect: '/workplace',
            children: [
                {
                    path: 'workplace',
                    name: '工作台',
                    component: () => import('@/pages/home/index'),
                    meta: {
                        icon: 'dashboard'
                    },
                },
                {
                    path: 'patrol',
                    name: '巡店管理',
                    meta: {
                        icon: 'form'
                    },
                    component: 'jimo',
                    children: [
                        {
                            path: 'shoprecords',
                            name: '巡店记录',
                            component: () => import('@/pages/patrol/shoprecords'),
                        },
                        {
                            path: 'shopstatistics',
                            name: '巡店统计',
                            component: () => import('@/pages/patrol/shopstatistics'),
                        },
                        {
                            path: 'shopconfig',
                            name: '巡店配置',
                            component: () => import('@/pages/patrol/shopconfig'),
                        },
                    ]
                },
                {
                    path: 'task',
                    name: '任务管理',
                    meta: {
                        icon: 'table',
                        page: {
                            cacheAble: false
                        }
                    },
                    component: 'jimo',
                    children: [
                        {
                            path: 'taskrecord',
                            name: '任务记录',
                            component: () => import('@/pages/task/taskrecord'),
                        },
                        {
                            path: 'taskstatistics',
                            name: '任务统计',
                            component: () => import('@/pages/task/taskstatistics'),
                        },
                        {
                            path: 'taskconfig',
                            name: '任务配置',
                            component: () => import('@/pages/task/taskconfig'),
                        }
                    ]
                }
            ]
        },]
    console.log(route2);
   

    function gettransform(arr){
        const route3 = arr[0]
        arr.shift()
        arr.forEach(item=>{
            delete item.redirect
            delete item.component
            item.component='jimo'
            route3.children.push(item)
        })
        return route3
    }
   const arr=  gettransform(route1)
  console.log(arr);
    </script>
</body>

</html>